<%@ include file="/WEB-INF/jsp/includes/include.jsp" %>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>${entity.name}</title>

        <c:set var="messageboard"><spring:theme code="messageboard"/></c:set>
        <link rel="stylesheet" href="<c:url value="${messageboard}"/>" type="text/css" />
        <c:set var="profile"><spring:theme code="profile"/></c:set>
        <link rel="stylesheet" href="<c:url value="${profile}"/>" type="text/css" />
        <c:set var="organisationprofile"><spring:theme code="organisationprofile"/></c:set>
        <link rel="stylesheet" href="<c:url value="${organisationprofile}"/>" type="text/css" />
		
	</head>

	<body>

		<!-- BEGIN LEFT COLUMN -->
		<div id="leftcolumn">

			<!-- BEGIN PROJECT PHOTO -->
			<div id="profilePhoto">
				<c:url scope="page" value="/getImage.do" var="entityImg">
					<c:param name="imgsrc" value="${entity.imgSrc}"/>
				</c:url>
			
				<a href="${entityImg}">
					<img src="${entityImg}" width="130" alt="${entity.name}" class="profilePhoto" />
				</a>
			</div>
			<!-- END PROJECT PHOTO -->

			<!-- BEGIN LEFT NAV OPTIONS -->
			<div id="leftnavOptions">

				<c:url scope="page" value="/organisation/editprofile.html" var="editOrganisationURL">
					<c:param name="id" value="${entity.id}"/>
				</c:url>
				<c:url scope="page" value="/organisation/join.html" var="joinOrganisationURL">
					<c:param name="id" value="${entity.id}"/>
				</c:url>
				<c:url scope="page" value="/organisation/leave.html" var="leaveOrganisationURL">
					<c:param name="id" value="${entity.id}"/>
				</c:url>
				<c:url scope="page" value="/organisation/inviteto.html" var="inviteToOrganisationURL">
					<c:param name="id" value="${entity.id}"/>				
				</c:url>
				<c:url scope="page" value="/noticeboard/edit.html" var="editNoticeBoardURL">
					<c:param name="id" value="${entity.id}"/>
				</c:url>


				<handsunited:relationship entity="${loggedInUser}" member="${entity}">
					<handsunited:status status="Unknown">
      					<a href="${joinOrganisationURL}"> &raquo; Join ${entity.name}</a>
    				</handsunited:status>
    					
					<handsunited:status status="Active">
						<handsunited:role role="admin">				
							<div id="editProfile" class="leftnavLink">
								<a href="${editOrganisationURL}" class="leftnavButton">&raquo; Edit ${entity.name}'s profile</a>
							</div> <!-- #editProfile -->
							<div id="editNoticeBoard" class="leftnavLink">
								<a href="editNoticeBoardURL" class="leftnavButton">&raquo; Edit notice board</a>
							</div>
						</handsunited:role>
						<handsunited:role role="notadmin">
							<div id="leaveOrganisation" class="leftnavLink">
								<a href="${leaveOrganisationURL}" class="leftnavButton">&raquo; Leave ${entity.name}</a>
							</div> <!-- #leaveOrganisation -->
						</handsunited:role>			
    				</handsunited:status>
    				<handsunited:status status="AwaitingAuthorisation">
    					Awaiting authorisation
    				</handsunited:status>
<%--    				
    				<handsunited:status status="ActionPending">
    					Authorise | Reject
    				</handsunited:status>
--%>    				
 	  			</handsunited:relationship>

				<div id="inviteTo" class="leftnavLink">
					<a href="${inviteToOrganisationURL}" class="leftnavButton">&raquo; Invite friends to support ${entity.name}</a>
				</div> <!-- #editProfile -->

			</div> <!-- #leftnavOptions -->

			<!-- END LEFT NAV OPTIONS -->

		</div>
		<!-- END LEFT COLUMN -->


		<!-- BEGIN CENTRE COLUMN -->
		<div id="centercolumn">

			<div id="organisationName">
				<h1 id="organisationName" class="entityName">${entity.name}</h1>
			</div>

			<div id="organisationSummary" class="summary">
				${entity.summary}
			</div> <!-- #organisationSummary -->


			<!-- BEGIN NOTICEBOARD -->
			<jsp:include page="/WEB-INF/jsp/tiles/noticeBoard.jsp"/>
			<!-- END NOTICEBOARD -->


			<!-- BEGIN ORGANISATION DESCRIPTION -->
			<div id="organisationDescription" class="description">
				${entity.description}
			</div> <!-- #organisationDescription -->
			<!-- END ORGANISATION DESCRIPTION -->

			<!-- BEGIN ORGANISATION DETAILS -->
			<div id="organisationDetails">

				<h2 id="organisationDetailsTitle" class="sectionHeader">Organisation details:</h2>

				<table id="organisationDetails" class="details">

					<colgroup>
						<col id="title" />
						<col id="content" />
					</colgroup>

					<tr class="row1">
						<td>Operating hours:</td>
						<td>
							<jsp:include page="/WEB-INF/jsp/tiles/availability.jsp"/>
						</td>
					</tr>
					<tr class="row2">
						<td>Location:</td>
						<td>
							${entity.location.number} ${entity.location.street}<br/>
							${entity.location.suburb}<br/>
							${entity.location.city}<br/>
							${entity.location.state } ${entity.location.postcode}
						</td>
					</tr>
					<tr class="row1">
						<td>Organisation categories:</td>
						<td>
							<c:forEach items="${entity.serviceCategories}" var="serviceCategory">
								<a href="#">${serviceCategory.name}</a> <br />
							</c:forEach>
						</td>
					</tr>
					<tr class="row2">
						<td>Website:</td>
						<td><a href="${entity.contactInfo.website}">${entity.contactInfo.website}</a></td>
					</tr>
				</table>
			</div> <!-- #organisationDetails -->
			<!-- END ORGANISATION DETAILS -->


			<!-- BEGIN CONTACT INFO -->
			<div id="organisationContactInfo" class="contactInfo">

				<h2 id="organisationContactInfoTitle" class="sectionHeader">Contact info:</h2>

				<table id="organisationContactInfoTable">
					<colgroup>
						<col id="title" />
						<col id="content" />
					</colgroup>

					<tr class="row1">
						<td>
							Name:
						</td>
						<td>
							${entity.contactInfo.name}
						</td>
					</tr>

					<tr class="row2">
						<td>Address:</td>
						<td>
							${entity.contactInfo.address.number} ${entity.contactInfo.address.street}<br/>
							${entity.contactInfo.address.suburb}<br/>
							${entity.contactInfo.address.city}<br/>
							${entity.contactInfo.address.state } ${entity.contactInfo.address.postcode}
						</td>
					</tr>

					<tr class="row1">
						<td>Phone numbers:</td>
						<td>
							Work: ${entity.contactInfo.workPhone} <br/>
							Mobile: ${entity.contactInfo.mobilePhone}
						</td>
					</tr>

					<tr class="row2">
						<td>Fax:</td>
						<td>${entity.contactInfo.faxNumber}</td>
					</tr>

					<tr class="row1">
						<td>Email address:</td>
						<td>
							<a href="mailto:${entity.contactInfo.emailAddress}">
								${entity.contactInfo.emailAddress}
							</a>
						</td>
					</tr>

				</table>

			</div> <!-- #organisationContactInfo -->
			<!-- END CONTACT INFO -->

			<!-- BEGIN MESSAGE BOARD -->
			<jsp:include page="/WEB-INF/jsp/tiles/messageBoard.jsp"/>
			<!-- END MESSAGE BOARD -->
			
		</div> <!-- #centercolumn -->

		<!-- END CENTRE COLUMN -->

		<!-- BEGIN RIGHT COLUMN -->
		<div id="rightcolumn">

			<!-- BEGIN USERS SECTION -->
			<jsp:include page="/WEB-INF/jsp/tiles/user/network.jsp"/>
			<!-- END USERS SECTION -->

			<!-- BEGIN PROJECTS SECTION -->
			<jsp:include page="/WEB-INF/jsp/tiles/project/network.jsp"/>
			<!-- END PROJECTS SECTION -->


			<!-- BEGIN ORGANISATIONS SECTION -->
			<jsp:include page="/WEB-INF/jsp/tiles/organisation/network.jsp"/>
			<!-- END ORGANISATIONS SECTION -->

		</div> <!-- #rightcolumn -->
		<!-- END RIGHT COLUMN -->

	</body>
</html>

		